﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace CheckoutCodeKata
{
    static class Program
    {
        static void Main(string[] args)
        {
            var textWriter = Console.Out;
            var prices = new Dictionary<string, int>
                          {
                              {"A", 50},
                              {"B", 30},
                              {"C", 20},
                              {"D", 15},
                          };

            var specialPricesRules = new List<SpecialPriceRule>
                                         {
                                             new SpecialPriceRule("A", 3, 130),
                                             new SpecialPriceRule("B", 2, 45),
                                         };

            var controller = new ControllerFactory(textWriter, prices, specialPricesRules).Create();
            
            var scanner = new Scanner(controller);
            var total = new Button(controller);

            Console.WriteLine("Inserisci i codici prodotto (es: AABC):");
            var line = Console.ReadLine();
            foreach (var itemCode in line)
            {
                scanner.Scan(itemCode.ToString());
            }
            total.Push();
            Console.ReadKey();
        }
    }
}
